home *** CD-ROM | disk | FTP | other *** search
- // the implementation of segpoint
- // Copyright (C) 1997 Kazutaka Hirata <khirata@jove.acs.unt.edu>
-
- #include "../common/base.h"
- #include "hesse.h"
- #include "seg.h"
- #include "xydbl.h"
-
- #include "segpoint.h"
-
- double GetDistanceFromOrigin(const SEGMENT& seg)
- {
- XY_DBL o(0, 0);
- double distance = minimum(get_distance(o, seg.p1()), get_distance(o, seg.p2()));
- HESSE hesse(seg);
- if(hesse.on_segment()) {
- distance = minimum(distance, hesse.c());
- }
-
- return distance;
- }
-